package com.kai.service.impl;


import com.kai.mapper.UserMapper;
import com.kai.pojo.User;
import com.kai.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    //查询用户名存在
    @Override
    public boolean findByUsername(String username) {
       return userMapper.findByUsername(username);
    }


    //注册用户
    @Override
    public void registered(User user) {
        user.setCreateTime(LocalDateTime.now());
        user.setUpdateTime(LocalDateTime.now());
        userMapper.registered(user);
    }

    @Override
    public boolean containUser(String username, String password) {
        return userMapper.containUser(username,password);
    }


}
